import { Request } from "./request";
////////首页
/**
 * 折线图相关
 */
export function getChartData() {
  return Request.axiosInstance({
    url: "/conversation/n_stat?days=7",
    method: "get",
  });
}
/**
 * 今日咨询总结
 */
export function getConversationSummary() {
  return Request.axiosInstance({
    url: "/conversation/today_stat_all",
    method: "get",
  });
}

////////
/**
 * 获取咨询师列表
 */
export function getOnlineTable_consultant() {
  return Request.axiosInstance({
    url: "user/list?page=0&size=99999&role=1",
    method: "get",
  });
}
/**
 * 获取督导列表
 */
export function getOnlineTable_supervisor() {
  return Request.axiosInstance({
    url: "user/list?page=0&size=99999&role=2",
    method: "get",
  });
}

////////排班表
/**
 * 添加排班
 */
export function addSchedule(arrangeTime: number, user: string) {
  const users = new Array(user);
  return Request.axiosInstance({
    url: "/arrange/add",
    method: "PUT",
    data: { arrangeTime, users },
  });
}
/**
 * 查询排班
 */
export function searchSchedule(arrangeTime: number) {
  return Request.axiosInstance({
    url: "/arrange/get?arrangeTime=" + arrangeTime,
    method: "GET",
  });
}
/**
 * 批量查询排班
 */
export function searchSchedule_month(arrangeTimeList: number[]) {
  return Request.axiosInstance({
    url: "/arrange/batch",
    method: "POST",
    data: { arrangeTimeList },
  });
}
/**
 * 删除排班
 */
export function deleteSchedule(arrangeID: number) {
  return Request.axiosInstance({
    url: "/arrange/delete",
    method: "DELETE",
    data: { arrangeID },
  });
}

////////管理页面
/**
 * 获取指定用户全部信息
 */
export function getCurrentUserData(counsellorID: string) {
  return Request.axiosInstance({
    url: "/user/superuser_get?counsellorID=" + counsellorID,
    method: "get",
  });
}
/**
 * 修改用户
 */
export function modifyUser(params: unknown) {
  return Request.axiosInstance({
    url: "/user/ms",
    method: "POST",
    data: params,
  });
}
/**
 * 删除用户
 */
export function deleteUser(counsellorID: string) {
  return Request.axiosInstance({
    url: "/user/ms",
    method: "DELETE",
    data: { counsellorID },
  });
}

////////咨询师管理页面
/**
 * 添加咨询师
 */
export function addConsultant(params: unknown) {
  return Request.axiosInstance({
    url: "/user/ms",
    method: "PUT",
    data: params,
  });
}
/**
 * 获取咨询师列表
 */
export function getConsultantList(params: unknown) {
  return Request.axiosInstance({
    url: "user/list",
    method: "get",
    params,
  });
}

////////督导管理页面
/**
 * 添加督导
 */
export function addSupervisor(params: unknown) {
  return Request.axiosInstance({
    url: "/user/ms",
    method: "PUT",
    data: params,
  });
}
/**
 * 获取督导列表
 */
export function getSupervisorList(params: unknown) {
  return Request.axiosInstance({
    url: "user/list",
    method: "get",
    params,
  });
}

////////访客页面
/**
 * 获取访客列表
 */
export function getVisitorList(params: unknown) {
  return Request.axiosInstance({
    url: "/visitor/list",
    method: "GET",
    params,
  });
}
/**
 * 禁用访客
 */
export function banVisitor(visitorID: string) {
  console.log({ visitorID });
  return Request.axiosInstance({
    url: "/visitor/ban",
    method: "POST",
    data: { visitorID },
  });
}
/**
 * 启用访客
 */
export function activateVisitor(visitorID: string) {
  return Request.axiosInstance({
    url: "/visitor/activate",
    method: "POST",
    data: { visitorID },
  });
}
